import { _decorator, Animation, Component, Node } from 'cc';
const { ccclass, property } = _decorator;

@ccclass('AnimationControl')
export class AnimationControl extends Component{
    //当前动画状态
    private _curState:string="";

    //播放动画
    playState(state:string){
        //判断是否是相同动画状态
        if(this._curState==state){
            return;
        }
        this._curState=state;
        //先暂停当前动画的所有状态
        let ani=this.node.getComponent(Animation);
        ani.stop();
        ani.play(this._curState);
        
    }
}


